import { http } from '@/utils/http'

export interface IFooItem {
  id: string
  name: string
}

// 菜品分页查询参数
export interface DishesQueryParams {
  name?: string
  categoryIds?: number[]
  tasteIds?: number[]
  difficulty?: string
  duration?: string
  page: number
  pageSize: number
}

// 菜品项
export interface DishItem {
  dishId: number
  name: string
  difficulty: string
  duration: string
  categories: string[]
  tastes: string[]
  mainImage: string
}

// 菜品分页响应
export interface DishesPageResp {
  total: number
  rows: DishItem[]
}

// 分类项
export interface CategoryItem {
  categoryId: number
  categoryName: string
}

// 获取菜品分页列表
export const getDishesAPI = (params: DishesQueryParams) => {
  return http.post<{ code: number; msg: string; data: DishesPageResp }>('/dishes', params)
}

// 获取所有分类
export const getCategoriesAPI = () => {
  return http.get<{ code: number; msg: string; data: CategoryItem[] }>('/categories')
}
